package org.bulldog.playlist;

import org.bulldog.playlist.notice.Notice;
import org.bulldog.playlist.util.DateUtil;

/**
 * 默认日志输出播放监听器-不提供外部使用
 *
 * @author zhanghongbin
 * @version 1.0
 */
class LoggingPlayListener implements PlayListener {

    @Override
    public final void onPlayListBuildFinish(Type type, Object object) {
        if (type == Type.PROGRAM) {
            System.out.println("节目播表生成结果:" + object);
        } else if (type == Type.NOTICE) {
            System.out.println("通知播表生成结果:" + object);
        }
    }

    @Override
    public void onPlay(Type type, Object object) {
        if (type == Type.PROGRAM) {
            System.out.println("节目播放时间:" + DateUtil.now() + " =======播放内容:" + object);
        } else if (type == Type.NOTICE) {
            Notice notice = (Notice) object;
            if (notice.getStatus() == 1) {
                System.out.println("通知开始播放时间:" + DateUtil.now() + " =======播放内容:" + object);
            } else {
                System.out.println("通知结束播放时间:" + DateUtil.now() + " =======播放内容:" + object);
            }
        } else if (type == Type.MESSAGE) {
            System.out.println("点播播放时间:" + DateUtil.now() + "=======播放内容:" + object);
        }
    }

}
